package com.lt.job_hunting;
import java.util.*;

public class LookJobWebsite implements subject {
	List<Person> people = new ArrayList<Person>();
	List<String> job = new ArrayList<String>(); //���ڴ�Ź���
	
	public void addJobFromCompany() {
		job.add("硬件");
		job.add("软件");
		job.add("UI");
	}
	//�ж���Ƹ��Ϣ�Ƿ�����ְ����Ҫ�Ĺ����������ǾͰ�������Ƹ��Ϣ������Ӧ����ְ��
	@Override
	public void attach(Person psn) {
		//�ж�����۲����Ƿ�ע��
			for(Object ps : people ) {
				if(ps == people) {
					return;
				}
			}
			people.add(psn);
	}
	@Override
	public void detach(Person psn) {
		people.remove(psn);
	}
	@Override
	public void notifyObserver() {
		for(Person ps : people ) {
			for(String j : job) {
				for(int i=0;i<ps.getlist().size();i++) {
					if(j == ((Person) ps).getJob(i)) {
						System.out.println("岗位" + j + "有合适岗位，发送提醒给用户" + ((Person) ps).getName());
						((Person)ps).receive(j);
					}
				}
					
			}
		}
	}
	
}
